<div class="container">
    <h2 class="mt-4"><%= gettext("Your Payment Portal") %></h2>

    <div class="row">
        <div class="col-md-4">
            <div class="widget widget-card-four">
                <div class="widget-content">
                    <div class="w-content">
                        <div class="w-info">
                            <h6 class="value">$ 0</h6>
                            <p class=""><%= gettext("Received") %></p>
                        </div>
                        <div class="">
                            <div class="w-icon">
                                <i class="fas fa-chevron-up"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="widget widget-card-four mt-2">
                <div class="widget-content">
                    <div class="w-content">
                        <div class="w-info">
                            <h6 class="value">$ 0</h6>
                            <p class=""><%= gettext("Sent") %></p>
                        </div>
                        <div class="">
                            <div class="w-icon">
                                <i class="fas fa-chevron-down"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card">
                <div class="card-body">
                    <%= if @has_payment_method do %>

                        <h5 class=""><%= gettext("Saved Payment Method") %></h5>

                        <p><%= gettext("You have an existing saved payment method. You can delete it by clicking the button below.") %></p>

                        <%= form_for @default_payment_changeset, Routes.user_payments_path(@conn, :delete_default_payment), fn _ -> %>
                            <%= if @default_payment_changeset.action do %>
                            <div class="alert alert-danger">
                                <p><%= gettext("Oops, something went wrong! Please check the errors below.") %></p>
                            </div>
                            <% end %>
                            <button type="submit" class="btn btn-block btn-danger"><%= gettext("Delete Saved Payment") %></button>
                        <% end %>

                    <% else %>
                    <div class="info">
                        <h5 class=""><%= gettext("Setup Payment Method") %></h5>
                        <!--<p class="inv-balance">$10,344</p>-->
                    </div>
                    <div class="acc-action">
                        <div class="">
                        <p><%= gettext("You can link a payment method by creating a subscription to a channel, or the platform.") %></p>
                        </div>
                    </div>
                    <% end %>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="widget widget-account-invoice-two">
                <div class="widget-content">
                    <div class="account-box">
                        <%= if @is_sub_ready_streamer do %>
                        <div class="info">
                            <h5 class=""><%= gettext("Sub-ready Streamer") %></h5>
                            <!--<p class="inv-balance">$10,344</p>-->
                        </div>
                        <div class="acc-action">
                            <div class="">
                            <h6><%= gettext("Welcome to the sub club!") %></h6>
                            </div>
                        </div>
                        <% else %>
                        <div class="info">
                            <h5 class=""><%= gettext("Streamer") %></h5>
                            <!--<p class="inv-balance">$10,344</p>-->
                        </div>
                        <div class="acc-action">
                            <div class="">
                            </div>
                            <a href="<%= @stripe_oauth_url %>" class="btn btn-light-default"><%= gettext("Enable Subscriptions") %></a>
                        </div>
                        <% end %>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <h4 class="mt-4"><%= gettext("Your Subscriptions") %></h4>
    <div class="row">
        <%= if @has_platform_subscription do %>
        <div class="col-md-3">
            <div class="card">
              <div class="card-body">
                <h5 class="card-title"><%= gettext("Glimesh Sub!") %></h5>
                <p class="card-text"><%= gettext("Subscribed since ?.") %></p>
                <%= link gettext("Unsubscribe"), to: Routes.platform_subscription_index_path(@conn, :index), class: "btn btn-danger btn-sm" %>
              </div>
            </div>
        </div>
        <% end %>
        <%= for sub <- @subscriptions do %>
            <div class="col-md-3">
                <div class="card">
                  <div class="card-body">
                    <h5 class="card-title"><%= sub.streamer.displayname %></h5>
                    <p class="card-text"><%= gettext("Subscribed since %{date}", date: sub.started_at) %></p>
                    <%= link "Unsubscribe", to: Routes.user_stream_path(@conn, :index, sub.streamer.displayname), class: "btn btn-danger btn-sm" %>
                  </div>
                </div>
            </div>
        <% end %>
    </div>
    <div class="card mt-4">
        <div class="card-header">
            <h5><%= gettext("Income History") %> </h5>
        </div>
        <div class="card-body">

        </div>
    </div>
    <div class="card mt-4">
        <div class="card-header">
            <h5><%= gettext("Payment History") %></h5>
        </div>
        <div class="card-body">

        </div>
    </div>
</div>
